﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Orchard.ContentManagement.MetaData.Builders;

namespace Rework.SocialMetadata.Settings {
    /// <summary>
    /// Settings on a Content Part
    /// </summary>
    public class SocialMetadataPartSettings {

        public SocialMetadataPartSettings() {
            string pattern = "";

            pattern = "property=\"og:site_name\" content=\"{Site.SiteName}\"" + Environment.NewLine;
            pattern += "property=\"og:title\" content=\"{Content.DisplayText}\"" + Environment.NewLine;
            pattern += "property=\"og:type\" content=\"website\"" + Environment.NewLine;
            pattern += "property=\"og:url\" content=\"{Content.DisplayUrl.Absolute}\"" + Environment.NewLine;
            pattern += "property=\"og:image\" content=\"{Content.Fields.ContentType.MediaPickerFieldName.Url.Absolute}\"" + Environment.NewLine;
            pattern += "property=\"og:image:width\" content=\"{Content.Fields.ContentType.MediaPickerFieldName.Width}\"" + Environment.NewLine;
            pattern += "property=\"og:image:height\" content=\"{Content.Fields.ContentType.MediaPickerFieldName.Height}\"" + Environment.NewLine;
            
            pattern += "name=\"twitter:site\" content=\"@twitter_handle\"" + Environment.NewLine;
            pattern += "name=\"twitter:creator\" content=\"@twitter_handle\"" + Environment.NewLine;

            PatternDefaultDefault = pattern;
        }

        private string PatternDefaultDefault;
        private string _patternDefault;
        public string PatternDefault {
            get {
                return !string.IsNullOrWhiteSpace(_patternDefault)
                    ? _patternDefault
                    : PatternDefaultDefault;
            }
            set { _patternDefault = value; }
        }
    }

    /// <summary>
    /// Settings when attaching part to a content item (on a Content Type)
    /// </summary>
    public class SocialMetadataTypePartSettings {
        public String Pattern { get; set; }
    }

    

}